home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / gdb.new.man < prev    next >
Encoding:
Text File  |  1992-06-09  |  9.4 KB  |  331 lines

  1.  
  2.  
  3.  
  4. gdb                       User Commands                       gdb
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      gdb - The GNU Debugger
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ggddbb  [--hheellpp] [--nnxx] [--qq] [--bbaattcchh] [--ccdd==_d_i_r] [--ff] [--bb _b_p_s]
  13.           [--ttttyy==_d_e_v] [--ss _s_y_m_f_i_l_e] [--ee _p_r_o_g] [--ssee _p_r_o_g] [--cc _c_o_r_e]
  14.           [--xx _c_m_d_s] [--dd _d_i_r] [_p_r_o_g[_c_o_r_e|_p_r_o_c_I_D]]
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The purpose of a debugger such as GDB is to allow you to see
  18.      what  is  going  on  ``inside''  another  program  while  it
  19.      executes-or what another program was doing at the moment  it
  20.      crashed.
  21.  
  22.      GDB can do four main kinds of things (plus other  things  in
  23.      support of these) to help you catch bugs in the act:
  24.  
  25.  
  26.         o+ Start your  program,  specifying  anything  that  might
  27.           affect its behavior.
  28.  
  29.  
  30.         o+ Make your program stop on specified conditions.
  31.  
  32.  
  33.         o+ Examine  what  has  happened,  when  your  program  has
  34.           stopped.
  35.  
  36.  
  37.         o+ Change things in your program, so  you  can  experiment
  38.           with  correcting  the  effects  of one bug and go on to
  39.           learn about another.
  40.  
  41.      You can use GDB to debug programs written  in  C,  C++,  and
  42.      Modula-2.   Fortran support will be added when a GNU Fortran
  43.      compiler is ready.
  44.  
  45.      GDB is invoked with the shell command ggddbb.  Once started, it
  46.      reads  commands  from the terminal until you tell it to exit
  47.      with the GDB command qquuiitt.  You can get online help from ggddbb
  48.      itself by using the command hheellpp.
  49.  
  50.      You can run ggddbb with no arguments or options; but  the  most
  51.      usual way to start GDB is with one argument or two, specify-
  52.      ing an executable program as the argument:
  53.  
  54.      gdb program
  55.  
  56.  
  57.      You can also start with both an  executable  program  and  a
  58.      core file specified:
  59.  
  60.  
  61.  
  62.  
  63. GNU Tools                   4nov1991                            1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. gdb                       User Commands                       gdb
  71.  
  72.  
  73.  
  74.      gdb program core
  75.  
  76.  
  77.      You can, instead, specify a process ID as a second argument,
  78.      if you want to debug a running process:
  79.  
  80.      gdb program 1234
  81.  
  82.  
  83.      would attach GDB to process 11223344 (unless  you  also  have  a
  84.      file named `11223344'; GDB does check for a core file first).
  85.  
  86.      Here are some of the most frequently needed GDB commands:
  87.  
  88.      bbrreeaakk [_f_i_l_e::]_f_u_n_c_t_i_o_n
  89.            Set a breakpoint at _f_u_n_c_t_i_o_n (in _f_i_l_e).
  90.  
  91.      rruunn [_a_r_g_l_i_s_t]
  92.           Start your program (with _a_r_g_l_i_s_t, if specified).
  93.  
  94.      bbtt   Backtrace: display the program stack.
  95.  
  96.      pprriinntt _e_x_p_r
  97.            Display the value of an expression.
  98.  
  99.      cc    Continue running your program (after stopping, e.g.  at
  100.           a breakpoint).
  101.  
  102.      nneexxtt Execute next program line (after stopping);  step  _o_v_e_r
  103.           any function calls in the line.
  104.  
  105.      sstteepp Execute next program line (after stopping);  step  _i_n_t_o
  106.           any function calls in the line.
  107.  
  108.      hheellpp [_n_a_m_e]
  109.           Show information about GDB  command  _n_a_m_e,  or  general
  110.           information about using GDB.
  111.  
  112.      qquuiitt Exit from GDB.
  113.  
  114.      For full details on GDB, see _U_s_i_n_g _G_D_B: _A _G_u_i_d_e _t_o  _t_h_e  _G_N_U
  115.      _S_o_u_r_c_e-_L_e_v_e_l  _D_e_b_u_g_g_e_r, by Richard M. Stallman and Roland H.
  116.      Pesch.  The same text is available online as the  ggddbb  entry
  117.      in the iinnffoo program.
  118.  
  119. OOPPTTIIOONNSS
  120.      Any arguments other than options specify an executable  file
  121.      and  core  file (or process ID); that is, the first argument
  122.      encountered with no associated option flag is equivalent  to
  123.      a  `--ssee'  option, and the second, if any, is equivalent to a
  124.      `--cc' option if it's the name of a file.  Many  options  have
  125.      both  long  and  short forms; both are shown here.  The long
  126.  
  127.  
  128.  
  129. GNU Tools                   4nov1991                            2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. gdb                       User Commands                       gdb
  137.  
  138.  
  139.  
  140.      forms are also recognized if you truncate them, so  long  as
  141.      enough  of the option is present to be unambiguous.  (If you
  142.      prefer, you can flag option arguments with `++'  rather  than
  143.      `--', though we illustrate the more usual convention.)
  144.  
  145.      All the options and command line arguments you give are pro-
  146.      cessed  in  sequential  order.  The order makes a difference
  147.      when the `--xx' option is used.
  148.  
  149.  
  150.      --hheellpp
  151.  
  152.      --hh   List all options, with brief explanations.
  153.  
  154.  
  155.      --ssyymmbboollss==_f_i_l_e
  156.  
  157.      --ss _f_i_l_e
  158.            Read symbol table from file _f_i_l_e.
  159.  
  160.  
  161.      --eexxeecc==_f_i_l_e
  162.  
  163.      --ee _f_i_l_e
  164.            Use file _f_i_l_e as the executable file to  execute  when
  165.           appropriate, and for examining pure data in conjunction
  166.           with a core dump.
  167.  
  168.  
  169.      --ssee==_f_i_l_e
  170.            Read symbol table from file _f_i_l_e and  use  it  as  the
  171.           executable file.
  172.  
  173.  
  174.      --ccoorree==_f_i_l_e
  175.  
  176.      --cc _f_i_l_e
  177.            Use file _f_i_l_e as a core dump to examine.
  178.  
  179.  
  180.      --ccoommmmaanndd==_f_i_l_e
  181.  
  182.      --xx _f_i_l_e
  183.            Execute GDB commands from file _f_i_l_e.
  184.  
  185.  
  186.      --ddiirreeccttoorryy==_d_i_r_e_c_t_o_r_y
  187.  
  188.      --dd _d_i_r_e_c_t_o_r_y
  189.            Add _d_i_r_e_c_t_o_r_y to the path to search for source files.
  190.  
  191.      --nnxx
  192.  
  193.  
  194.  
  195. GNU Tools                   4nov1991                            3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. gdb                       User Commands                       gdb
  203.  
  204.  
  205.  
  206.      --nn   Do not execute commands from any `..ggddbbiinniitt' initializa-
  207.           tion  files.  Normally, the commands in these files are
  208.           executed after all the command  options  and  arguments
  209.           have been processed.
  210.  
  211.  
  212.  
  213.      --qquuiieett
  214.  
  215.      --qq   ``Quiet''.  Do not print the introductory and copyright
  216.           messages.   These messages are also suppressed in batch
  217.           mode.
  218.  
  219.  
  220.      --bbaattcchh
  221.           Run in batch mode.  Exit with status 00 after processing
  222.           all   the   command  files  specified  with  `--xx'  (and
  223.           `..ggddbbiinniitt',  if  not  inhibited).   Exit  with  nonzero
  224.           status if an error occurs in executing the GDB commands
  225.           in the command files.
  226.  
  227.           Batch mode may be useful for running GDB as  a  filter,
  228.           for  example  to  download and run a program on another
  229.           computer; in order to make this more useful,  the  mes-
  230.           sage
  231.  
  232.           Program exited normally.
  233.  
  234.  
  235.           (which is ordinarily issued whenever a program  running
  236.           under  GDB  control terminates) is not issued when run-
  237.           ning in batch mode.
  238.  
  239.  
  240.      --ccdd==_d_i_r_e_c_t_o_r_y
  241.            Run GDB using  _d_i_r_e_c_t_o_r_y  as  its  working  directory,
  242.           instead of the current directory.
  243.  
  244.  
  245.      --ffuullllnnaammee
  246.  
  247.      --ff   Emacs sets this option when it runs GDB  as  a  subpro-
  248.           cess.   It  tells  GDB to output the full file name and
  249.           line number in a standard,  recognizable  fashion  each
  250.           time  a  stack  frame is displayed (which includes each
  251.           time the  program  stops).   This  recognizable  format
  252.           looks  like  two ` 3322' characters, followed by the file
  253.           name, line number and character position  separated  by
  254.           colons, and a newline.  The Emacs-to-GDB interface pro-
  255.           gram uses the two  ` 3322'  characters  as  a  signal  to
  256.           display the source code for the frame.
  257.  
  258.  
  259.  
  260.  
  261. GNU Tools                   4nov1991                            4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. gdb                       User Commands                       gdb
  269.  
  270.  
  271.  
  272.      --bb _b_p_s
  273.            Set the line speed (baud rate or bits per  second)  of
  274.           any serial interface used by GDB for remote debugging.
  275.  
  276.  
  277.      --ttttyy==_d_e_v_i_c_e
  278.            Run using _d_e_v_i_c_e for your program's standard input and
  279.           output.
  280.  
  281. SSEEEE AALLSSOO
  282.      `ggddbb' entry in iinnffoo; _U_s_i_n_g _G_D_B: _A _G_u_i_d_e _t_o _t_h_e  _G_N_U  _S_o_u_r_c_e-
  283.      _L_e_v_e_l  _D_e_b_u_g_g_e_r,  Richard  M.  Stallman and Roland H. Pesch,
  284.      July 1991.
  285.  
  286. CCOOPPYYIINNGG
  287.      Copyright (c) 1991 Free Software Foundation, Inc.
  288.  
  289.      Permission is granted to make and distribute verbatim copies
  290.      of  this  manual provided the copyright notice and this per-
  291.      mission notice are preserved on all copies.
  292.  
  293.      Permission is granted to copy and distribute  modified  ver-
  294.      sions of this manual under the conditions for verbatim copy-
  295.      ing, provided that the entire resulting derived work is dis-
  296.      tributed under the terms of a permission notice identical to
  297.      this one.
  298.  
  299.      Permission is granted to copy and distribute translations of
  300.      this  manual  into  another language, under the above condi-
  301.      tions for modified versions,  except  that  this  permission
  302.      notice  may be included in translations approved by the Free
  303.      Software Foundation instead of in the original English.
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327. GNU Tools                   4nov1991                            5
  328.  
  329.  
  330.  
  331.